{% load l10n material_form material_form_internal %}
{% part field columns asvar 'columns' %}1{% endpart %}
{% part field group_columns asvar 'group_columns' %}12{% endpart %}
{% part bound_field.field %}<div class="row checkbox-field">
    {% part field label %}<div class="col s12">
        <label{% attrs bound_field 'label' %}
            for="{{ bound_field.id_for_label }}"
        {% endattrs %}>{{ bound_field.label }}</label>
    </div>{% endpart %}
    <div{% attrs bound_field 'group' %}
        id="id_{{ bound_field.html_name }}_container"
        class="col s12{% if field.required%} required{% endif %}{% if bound_field.errors %} has-error{% endif %}"
    {% endattrs %}>
        {% part field prefix %}{% endpart %}{% part field control %}
        <div class="row">
            {% for group, items in bound_field|select_options %}
                {% if group %}<div class="col l{{ group_columns }}"><h6 style="font-size: .8rem;color: #9e9e9e;padding-left: 12px;">{{ group }}</h6>{% endif %}
                {% for col_span, choices in items|split_choices_by_columns:columns %}<div class="col l{{ col_span }}">
                {% for choice, value, selected, position in choices %}
                <div class="checkbox" id="id_{{ bound_field.html_name }}"><label>
                    <input{% attrs bound_field 'widget' default field.widget.attrs %}
                        id="id_{{ bound_field.html_name }}_{{ position }}"
                        name="{{ bound_field.html_name }}"
                        type="checkbox"
                        {% if bound_field.errors %}class="invalid"{% endif %}
                        value="{{ value|unlocalize }}"
                        {% if field.disabled %}disabled{% endif %}
                        {% if selected %}checked{% endif %}
                    {% endattrs %}/>
                    <span for="id_{{ bound_field.html_name }}_{{ position }}">{{ choice }}</span>
                </label></div>
                {% endfor %}</div>{% endfor %}
                {% if group %}</div>{% endif %}
            {% endfor %}
        </div>
        {% endpart %}{% part field help_text %}{% if field.help_text %}
        <div class="help-block">{{ bound_field.help_text|safe }}</div>
        {% endif %}{% part field errors %}
        {% if bound_field.errors %}
            {% include  'material/field_errors.html' %}
        {% endif %}{% endpart %}
        {% endpart %}{{ hidden_initial }}
    </div>
</div>{% endpart %}
